#include "class_study.h"
#include <iostream>

using namespace std;

//构造函数不能是虚函数 只有虚函数才能被继承 且纯虚函数必须被重写 注意编译时将cpp文件加入编译列表

Animal::Animal(int height)
{
    this->height = height;
    cout << "Animal 正在被构造" << endl;

}

Animal::~Animal()
{
    cout << "Animal 正在被析构" << endl;

}



void Animal::eat()
{
    cout << "Animal 正在eat" << endl;
}

Bird::Bird(int height):Animal(height)
{
    cout << "Bird 正在被构造" << endl;

}

Bird::~Bird()
{
    // Animal::~Animal();
    cout << "Bird 正在被析构" << endl;

}


void Bird::eat() 
{
    cout << "Bird 正在eat "<< "height: " << height << endl;
}

void Bird::fly()
{
    cout << "Bird 正在fly" << endl;
}